package topcoder;

import java.util.ArrayList;
import java.util.List;

public class ABitOfFun {
	
	/**
	 * 
	 */
	public static void testBit(){
		/*int a = 10;//1010
		int b = 5;//0101
		int c = 1;
		int d = -4;//when it's negative, the result of division is always -1
		//and the result of multiplication acts normal
		System.out.println(a<<1);
		System.out.println(Integer.toBinaryString(a<<1));
		System.out.println(b>>1);
		System.out.println(c>>1);
		System.out.println(d>>3);
		System.out.println(d<<1);
		a|= 1<<0;//set the position 2 of a to be one: 1110
		//position starts from 0 from lower side
		System.out.println("*"+Integer.toBinaryString(a));
		a &= ~(1<<3);//clear position 3 of a : 110
		System.out.println(a);
		System.out.println(a & 1 << 3);//test the bit of position 3 of a
		System.out.println(Integer.bitCount(256));
		System.out.println(Integer.toBinaryString(20));
		System.out.println(Integer.toBinaryString(20&(~(20 - 1))));
		//a = 10;
		//a &= ~(1<<1);
		System.out.println(Long.highestOneBit(Long.MAX_VALUE));//*/
		List<String> ss = new ArrayList<String>();
		ss.add("111".substring(5));
		Byte ddd = (byte) 110000000;
		System.out.println(ss.get(0));
		
	}
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		testBit();
	}

}
